package com.csyf.manager.controller.system;

import com.csyf.manager.entity.SysAgentChannel;
import com.csyf.manager.service.SysChannelBiz;
import com.csyf.manager.utils.page.JqGridVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: casper
 * @Description: 交易通道管理
 * @Date: Created in 2018/12/19 12:40
 */
@Controller
@RequestMapping("/tradeChan")
public class SysTradeChannelController {

    @Autowired
    private SysChannelBiz sysChannelBiz;

    /**
     * 支付通道列表
     *
     * @param vo
     * @param rows
     * @param page
     * @return
     */
    @ResponseBody
    @PostMapping(value = "/tradeChanList")
    public JqGridVo channelDataList(SysAgentChannel vo, Integer page, Integer rows) {
        return sysChannelBiz.querydata(vo, page, rows);
    }

    /**
     * 获取支付通道详情
     * @param model
     * @param tradeChanId
     * @return
     */
    @GetMapping("/detail")
    public String tradeChanDetail(Model model, String tradeChanId) {
        SysAgentChannel tradeChan = sysChannelBiz.queryChannelById(Long.valueOf(tradeChanId));
        model.addAttribute("tradeChan", tradeChan);
        return "channel/tradeChanDetail";
    }

}
